<template>
	<block v-if="settle_type=='time'">
		<fui-text :font-weight="fontWeight" v-if="balance>=0" :text="(showTitle?'余额：':'')+formatDuration(balance)" :color="color?color:'#12a744'" :size="size"></fui-text>
		<fui-text :font-weight="fontWeight" v-else :text="(showTitle?'余额：':'')+'欠'+formatDuration(-balance)" :color="color?color:'red'" :size="size"></fui-text>
	</block>
	<block v-if="settle_type=='before'">
		<fui-text :font-weight="fontWeight" v-if="balance>=0" :text="(showTitle?'余额：':'')+'￥'+parseNumber(balance)" :color="color?color:'#12a744'" :size="size"></fui-text>
		<fui-text :font-weight="fontWeight" v-else :text="(showTitle?'余额：':'')+'欠￥'+parseNumber(-balance)" :color="color?color:'red'" :size="size"></fui-text>
	</block>
	<block v-if="settle_type=='after'">
		<fui-text :font-weight="fontWeight" v-if="balance>=0" :text="(showTitle?'账单：':'')+'余￥'+parseNumber(balance)" :color="color?color:'#12a744'" :size="size"></fui-text>
		<fui-text :font-weight="fontWeight" v-else :text="(showTitle?'账单：':'')+'￥'+parseNumber(-balance)" :color="color?color:'red'" :size="size"></fui-text>
	</block>
</template>

<script>
	import {parseNumber} from '@/utils/util.js'
	export default {
		name:'merch-balance',
		data() {
			return {
				
			}
		},
		props:{
			size:{
				type:Number,
				default:28
			},
			line:{
				type:Boolean,
				default:true
			},
			balance:{
				type:[Number,String],
				default:0
			},
			settle_type:{
				type:String,
				default:'before'
			},
			fontWeight:{
				type:Number,
				default:400
			},
			showTitle:{
				type:Boolean,
				default:false
			},
			color:{
				type:String,
				default:''
			}
		},
		mounted(){
			
		},
		methods: {
			parseNumber,
			formatDuration:function(data){
				let str=parseInt(data)+'分钟';
				return str;
			}
		}
	}
</script>

<style lang="scss" scoped>

</style>